package src.lab02.test01.test37;

import java.util.ArrayList;
import java.util.List;

public class StudentDemo {
        public static void main(String[] args) {
            //于本科生，如果3门课程的平均分数超过60分即表示通过，

            List<Student>list=new ArrayList<Student>();

            list.add(new Undergraduate(80,60,45));
            list.add(new Undergraduate(60,90,40));
            list.add(new Graduate(55,66,77));
            list.add(new Graduate(76,32,91));
            for (int i = 0; i < list.size(); i++) {
                String name="";
                String sign="";
                if(list.get(i) instanceof Undergraduate) {
                    name="本科生";
                }else
                {
                    name="研究生";
                }
                if(!list.get(i).pass()){
                    sign="未";
                }
                System.out.println("第"+(i+1)+"名学生是"+name+"考试"+sign+"通过,平均分为："+list.get(i).getAvg());
            }
        }

    }
